#include <iostream>
#include <string>
using namespace std;
typedef long long LL;
string s;

void solv()
{
    LL res = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] != '2')
            continue;
        for (int j = i + 1; j < s.size(); j++)
        {
            if (s[j] != '0')
                continue;
            for (int k = j + 1; k < s.size(); k++)
            {
                if (s[k] != '2')
                    continue;
                for (int l = k + 1; l < s.size(); l++)
                {
                    if (s[l] != '3')
                        continue;
                    if (s[i] == '2' && s[j] == '0' && s[k] == '2' && s[l] == '3')
                        res++;
                }
            }
        }
    }
    cout << res << endl;
}

int main()
{
    for (int j = 1; j <= 2023; j++)
    {
        string p = to_string(j);
        for (int i = 0; i < p.size(); i++)
        {
            if (p[i] == '2' || p[i] == '0' || p[i] == '3')
            {
                s += p[i];
            }
        }
    }
    //    cout << s.size() << endl;
    //    cout << s << endl;
    solv();
    return 0;
}